home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Almathera Ten Pack 3: CDPD 3
/
Almathera Ten on Ten - Disc 3: CDPD3.iso
/
fish
/
001-100
/
001-025
/
004
/
bm
/
printline.c
< prev
next >
Wrap
C/C++ Source or Header
|
1995-03-17
|
861b
|
40 lines
#include <stdio.h>
#ifdef BSD
#include <strings.h>
#else
#include <string.h>
#endif
#include "Extern.h"
PrintLine(OffSet,LineStart,LineEnd)
int OffSet; /* offset of LineStart from beginning of file */
char *LineStart,
*LineEnd;
{
char OffStr[80];
if (lFlag) {
if (strlen(FileName) > 76) {
fprintf(stderr,"bm: filename too long\n");
exit(2);
} /* if */
sprintf(OffStr,"%s\n",FileName);
write(1,OffStr,strlen(OffStr));
return;
} /* if */
if (FileName && !hFlag) {
if (strlen(FileName) > 76) {
fprintf(stderr,"bm: filename too long\n");
exit(2);
} /* if */
sprintf(OffStr,"%s:",FileName);
write(1,OffStr,strlen(OffStr));
} /* if */
if (nFlag) {
sprintf(OffStr,"%d: ",OffSet);
write(1,OffStr,strlen(OffStr));
} /* if */
write(1,LineStart,LineEnd-LineStart+1);
if (*LineEnd != '\n') write (1,"\n",1);
} /* PrintLine */